With a reduction in size of a portable communication device or the like, the number of devices having a folding mechanism is on the rise. A method of detecting a state of the folding mechanism includes a method using a magnet and a magnetic sensor circuit. In a magnetic sensor circuit described as an embodiment of the invention in Patent Document 1, a magnetoresistive element is used as a magnetic detection element. When the magnetic detection element and a signal processing circuit are integrally formed on a semiconductor IC using a silicon substrate, as also described in Prior Art Section of Patent Document 1, a Hall element may be selected for use as the magnetic detection element. FIG. 6 illustrates an example of the magnetic sensor circuit using the Hall element.
The magnetic sensor circuit illustrated in FIG. 6 includes a Hall element 11, a voltage source 12, an amplifier 3, a comparator 4, and a voltage source 42. The voltage source 12 generating a voltage Vdd is connected with a pair of terminals “a” and “b” of the Hall element 11. A pair of terminals “c” and “d” of the Hall element 11 are connected with a non-inverting input terminal (+) and an inverting input terminal (−) of the amplifier 3, respectively. An operating point of the amplifier 3 is set such that the amplifier 3 outputs a voltage Vdd/2 when the non-inverting input terminal (+) thereof is equal in potential to the inverting input terminal (−) thereof. One of input terminals of the comparator 4 is connected with an output terminal of the amplifier 3 and the other input terminal thereof is connected with the voltage source 42. The voltage source 42 generates a threshold voltage Vth2. An output terminal of the comparator 4 is connected with an output terminal OUT which is a signal output terminal of the magnetic sensor circuit.
In the magnetic sensor circuit having the structure described above, when there exists a magnetic material such as a permanent magnet in a position near the Hall element 11, a magnetic flux generated by the magnetic material passes through the Hall element 11, whereby a Hall voltage generates between the terminals (c-d). The Hall voltage is amplified by a gain (hereinafter expressed by A3) by the amplifier 3, and transferred to the one input terminal of the comparator 4.
The comparator 4 generates an output signal having a high level when an output of the amplifier 3 is larger than the threshold voltage Vth2. Then, the high-level signal indicating that there exists the magnetic material in the position near the Hall element 11 is output to the output terminal OUT.
The comparator 4 performs comparison operation based on the assumption that a state in which the output voltage of the amplifier 3 is Vdd/2 is a state in which there exists the magnetic material such as the permanent magnet ideally at an infinite distance from the Hall element 11, that is, a state in which the magnetic flux passing through the Hall element 11 is zero.
A polarity of the Hall voltage generated between the terminals (c-d) of the Hall element 11 is reversed according to a direction of the magnetic flux passing through the Hall element 11. For example, as illustrated in FIG. 6, a case where a magnetic flux passing from an upper surface of the Hall element 11 to an inner portion thereof is defined as a forward direction, and a case where a magnetic flux passing from the inner portion thereof to the upper surface thereof is defined as a reverse direction. The polarity of the Hall voltage is positive in the forward direction and negative in the reverse direction. The magnetic sensor circuit illustrated in FIG. 6 deals with only a forward direction relationship between the magnetic flux and the Hall element 11. Therefore, in a case of a reverse relationship between the magnetic flux and the Hall element 11, even when there exists a magnetic material in a near position, the magnetic material cannot be detected.
FIG. 7 is a block diagram illustrating a magnetic sensor circuit dealing with the forward and reverse magnetic fluxes. The magnetic sensor circuit illustrated in FIG. 7 includes a voltage source 43 generating a threshold voltage Vth3 with respect to the reverse magnetic flux and a switch circuit 41. The threshold voltage is selected by the switch circuit 41 and input to the comparator 4. A sample-and-hold circuit 9 is connected between an output of the comparator 4 and the output terminal OUT. The sample-and-hold circuit 9 includes a first sample-and-hold circuit including a switch 91 and a capacitor 93, a second sample-and-hold circuit including a switch 92 and a capacitor 94, and a logic circuit 95.
The switches 91 and 92 are operated in conjunction with the switch circuit 41. A result obtained by detecting the forward magnetic flux is stored in the capacitor 93. A result obtained by detecting the reverse magnetic flux is stored in the capacitor 94. When at least one of the detected magnetic fluxes is larger than a predetermined value, the high level is output to the output terminal OUT.
In this related art, as described above, the magnetic flux passing through the Hall element 11 is generated from the magnetic material, and whether or not there exists the magnetic material in the position near the Hall element 11 can be detected. It should be noted that, when a magnetic flux generated around a current detection conductor located in the near position based on Ampere's law is applied instead of the magnetic flux generated from the magnetic material, it is also possible to detect a state in which a current larger than a predetermined value flows through the current detection conductor.    Patent Document 1: JP 09-166405 A